home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-MIPS / SIGINFO.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  6KB  |  206 lines

  1. /* $Id: siginfo.h,v 1.4 1998/08/28 16:23:06 ralf Exp $
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 1998 by Ralf Baechle
  8.  */
  9. #ifndef __ASM_MIPS_SIGINFO_H
  10. #define __ASM_MIPS_SIGINFO_H
  11.  
  12. #include <linux/types.h>
  13.  
  14. /* This structure matches OSF/1 for binary compatibility. */
  15.  
  16. typedef union sigval {
  17.     int sival_int;
  18.     void *sival_ptr;
  19. } sigval_t;
  20.  
  21. #define SI_MAX_SIZE    128
  22. #define SI_PAD_SIZE    ((SI_MAX_SIZE/sizeof(int)) - 4)
  23.  
  24. typedef struct siginfo {
  25.     int si_signo;
  26.     int si_errno;
  27.     int si_code;
  28.  
  29.     union {
  30.         int _pad[SI_PAD_SIZE];
  31.  
  32.         /* kill() */
  33.         struct {
  34.             pid_t _pid;        /* sender's pid */
  35.             uid_t _uid;        /* sender's uid */
  36.         } _kill;
  37.  
  38.         /* POSIX.1b timers */
  39.         struct {
  40.             unsigned int _timer1;
  41.             unsigned int _timer2;
  42.         } _timer;
  43.  
  44.         /* POSIX.1b signals */
  45.         struct {
  46.             pid_t _pid;        /* sender's pid */
  47.             uid_t _uid;        /* sender's uid */
  48.             sigval_t _sigval;
  49.         } _rt;
  50.  
  51.         /* SIGCHLD */
  52.         struct {
  53.             pid_t _pid;        /* which child */
  54.             uid_t _uid;        /* sender's uid */
  55.             int _status;        /* exit code */
  56.             clock_t _utime;
  57.             clock_t _stime;
  58.         } _sigchld;
  59.  
  60.         /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  61.         struct {
  62.             void *_addr; /* faulting insn/memory ref. */
  63.         } _sigfault;
  64.  
  65.         /* SIGPOLL */
  66.         struct {
  67.             int _band;    /* POLL_IN, POLL_OUT, POLL_MSG */
  68.             int _fd;
  69.         } _sigpoll;
  70.     } _sifields;
  71. } siginfo_t;
  72.  
  73. /*
  74.  * How these fields are to be accessed.
  75.  */
  76. #define si_pid        _sifields._kill._pid
  77. #define si_uid        _sifields._kill._uid
  78. #define si_status    _sifields._sigchld._status
  79. #define si_utime    _sifields._sigchld._utime
  80. #define si_stime    _sifields._sigchld._stime
  81. #define si_value    _sifields._rt._sigval
  82. #define si_int        _sifields._rt._sigval.sival_int
  83. #define si_ptr        _sifields._rt._sigval.sival_ptr
  84. #define si_addr        _sifields._sigfault._addr
  85. #define si_band        _sifields._sigpoll._band
  86. #define si_fd        _sifields._sigpoll._fd
  87.  
  88. /*
  89.  * si_code values
  90.  * Digital reserves positive values for kernel-generated signals.
  91.  */
  92. #define SI_USER        0    /* sent by kill, sigsend, raise */
  93. #define SI_KERNEL    0x80    /* sent by the kernel from somewhere */
  94. #define SI_QUEUE    -1    /* sent by sigqueue */
  95. #define SI_ASYNCIO    -2    /* sent by AIO completion */
  96. #define SI_TIMER    -3    /* sent by timer expiration */
  97. #define SI_MESGQ    -4    /* sent by real time mesq state change */
  98. #define SI_SIGIO    -5    /* sent by queued SIGIO */
  99.  
  100. #define SI_FROMUSER(siptr)    ((siptr)->si_code <= 0)
  101. #define SI_FROMKERNEL(siptr)    ((siptr)->si_code > 0)
  102.  
  103. /*
  104.  * SIGILL si_codes
  105.  */
  106. #define ILL_ILLOPC    1    /* illegal opcode */
  107. #define ILL_ILLOPN    2    /* illegal operand */
  108. #define ILL_ILLADR    3    /* illegal addressing mode */
  109. #define ILL_ILLTRP    4    /* illegal trap */
  110. #define ILL_PRVOPC    5    /* privileged opcode */
  111. #define ILL_PRVREG    6    /* privileged register */
  112. #define ILL_COPROC    7    /* coprocessor error */
  113. #define ILL_BADSTK    8    /* internal stack error */
  114. #define NSIGILL        8
  115.  
  116. /*
  117.  * SIGFPE si_codes
  118.  */
  119. #define FPE_INTDIV    1    /* integer divide by zero */
  120. #define FPE_INTOVF    2    /* integer overflow */
  121. #define FPE_FLTDIV    3    /* floating point divide by zero */
  122. #define FPE_FLTOVF    4    /* floating point overflow */
  123. #define FPE_FLTUND    5    /* floating point underflow */
  124. #define FPE_FLTRES    6    /* floating point inexact result */
  125. #define FPE_FLTINV    7    /* floating point invalid operation */
  126. #define FPE_FLTSUB    8    /* subscript out of range */
  127. #define NSIGFPE        8
  128.  
  129. /*
  130.  * SIGSEGV si_codes
  131.  */
  132. #define SEGV_MAPERR    1    /* address not mapped to object */
  133. #define SEGV_ACCERR    2    /* invalid permissions for mapped object */
  134. #define NSIGSEGV    2
  135.  
  136. /*
  137.  * SIGBUS si_codes
  138.  */
  139. #define BUS_ADRALN    1    /* invalid address alignment */
  140. #define BUS_ADRERR    2    /* non-existant physical address */
  141. #define BUS_OBJERR    3    /* object specific hardware error */
  142. #define NSIGBUS        3
  143.  
  144. /*
  145.  * SIGTRAP si_codes
  146.  */
  147. #define TRAP_BRKPT    1    /* process breakpoint */
  148. #define TRAP_TRACE    2    /* process trace trap */
  149. #define NSIGTRAP
  150.  
  151. /*
  152.  * SIGCHLD si_codes
  153.  */
  154. #define CLD_EXITED    1    /* child has exited */
  155. #define CLD_KILLED    2    /* child was killed */
  156. #define CLD_DUMPED    3    /* child terminated abnormally */
  157. #define CLD_TRAPPED    4    /* traced child has trapped */
  158. #define CLD_STOPPED    5    /* child has stopped */
  159. #define CLD_CONTINUED    6    /* stopped child has continued */
  160. #define NSIGCHLD
  161.  
  162. /*
  163.  * SIGPOLL si_codes
  164.  */
  165. #define POLL_IN        1    /* data input available */
  166. #define POLL_OUT    2    /* output buffers available */
  167. #define POLL_MSG    3    /* input message available */
  168. #define POLL_ERR    4    /* i/o error */
  169. #define POLL_PRI    5    /* high priority input available */
  170. #define POLL_HUP    6    /* device disconnected */
  171. #define NSIGPOLL    6
  172.  
  173. /*
  174.  * sigevent definitions
  175.  * 
  176.  * It seems likely that SIGEV_THREAD will have to be handled from 
  177.  * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
  178.  * thread manager then catches and does the appropriate nonsense.
  179.  * However, everything is written out here so as to not get lost.
  180.  */
  181. #define SIGEV_SIGNAL    0    /* notify via signal */
  182. #define SIGEV_NONE    1    /* other notification: meaningless */
  183. #define SIGEV_THREAD    2    /* deliver via thread creation */
  184.  
  185. #define SIGEV_MAX_SIZE    64
  186. #define SIGEV_PAD_SIZE    ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
  187.  
  188. typedef struct sigevent {
  189.     sigval_t sigev_value;
  190.     int sigev_signo;
  191.     int sigev_notify;
  192.     union {
  193.         int _pad[SIGEV_PAD_SIZE];
  194.  
  195.         struct {
  196.             void (*_function)(sigval_t);
  197.             void *_attribute;    /* really pthread_attr_t */
  198.         } _sigev_thread;
  199.     } _sigev_un;
  200. } sigevent_t;
  201.  
  202. #define sigev_notify_function    _sigev_un._sigev_thread._function
  203. #define sigev_notify_attributes    _sigev_un._sigev_thread._attribute
  204.  
  205. #endif /* __ASM_MIPS_SIGINFO_H */
  206.